import asyncio
from motor.motor_asyncio import AsyncIOMotorClient
from datetime import datetime

async def check_db():
    client = AsyncIOMotorClient('mongodb://localhost:27017')
    db = client.project_management
    
    # 检查用户集合是否存在
    collections = await db.list_collection_names()
    print(f'Available collections: {collections}')
    
    if 'users' in collections:
        # 检查用户数据
        users_count = await db.users.count_documents({})
        print(f'Total users in database: {users_count}')
        
        # 查看一个用户示例
        user_sample = await db.users.find_one({})
        if user_sample:
            print(f'Sample user keys: {list(user_sample.keys())}')
            print(f'User status: {user_sample.get("status")}')
            print(f'User created_at type: {type(user_sample.get("created_at"))}')
            print(f'User created_at value: {user_sample.get("created_at")}')
        else:
            print('No users found in database')
    else:
        print('Users collection does not exist')
    
    client.close()

if __name__ == "__main__":
    asyncio.run(check_db())